package overrideoverwrite;

import java.util.HashMap;
import java.util.HashSet;

/**
 * @ClassName RecordPerson
 * @Date 2024/11/28 15:36 02
 * @Author Jack Chen
 * @Description serenity-cucumber-auto-project-jack
 * @Version 1.0
 */

public record Persion(String name, int age) {
    public Persion {
        HashMap<String, String> sx = new HashMap<>();
        HashSet<String> xs = new HashSet<>();
        sx.put("name", "");
        //if (StringUtils.isBlank(name)) {
        if (name.isBlank()) {
            throw new IllegalArgumentException("name cannot be blank");
        }
        if (age < 0) {
            throw new IllegalArgumentException("age cannot be negative");
        }
    }

    public Persion(String name) {
        this(name, 0);
    }

    @Override
    public String name() {
        return name.toUpperCase();
    }


}
